home *** CD-ROM | disk | FTP | other *** search
/ Best of www.BestZips.com (Collector's Edition) / Best of WWW.BESTZIPS.COM Collector's Edition (JCSM Shareware) (JCS Marketing).ISO / gamebord / chsclk20.zip / SOUND.C < prev    next >
C/C++ Source or Header  |  1996-10-23  |  2KB  |  101 lines

  1. // Sound Module
  2. // M\Cooper, PO Box 237, St. David, AZ 85630-0237
  3. // E-mail: thegrendel@theriver.com
  4. // Web:  http://personal.riverusers.com/~thegrendel/
  5.  
  6.  
  7. #include <dos.h>
  8.  
  9.  
  10. #define FREQ 900
  11. #define DELAY 100
  12.  
  13. void beep1( void ),
  14.     beep2( void );
  15.  
  16. /***************************************************************************/
  17. /*                                   BEEPS                                 */
  18. /***************************************************************************/
  19.  
  20. void beep1()
  21. {
  22.      sound( FREQ );
  23.      delay( DELAY );
  24.      nosound();
  25.      return;
  26. }
  27.  
  28. void beep2()
  29. {
  30.      beep1();
  31.      delay( DELAY / 2 );
  32.      beep1();
  33.      return;
  34. }
  35.  
  36. /**********************************TONE***********************************/
  37. /*         Produces tone at frequency, duration (of sound)               */
  38. /*     Arguments in: freq [in Hz], dur [duration in millisec.]           */
  39. /*************************************************************************/
  40.  
  41. void tone( int freq, int dur )
  42. {
  43.         sound( freq );
  44.         delay( dur );
  45.         nosound();
  46.         return;
  47. }
  48.  
  49. /**************************************************************************/
  50. /*                 Produces a "two-tone" sound  (beep-boop)               */
  51. /**************************************************************************/
  52. void two_tone()
  53.  
  54. {
  55.     int frequency,
  56.          duration;
  57.  
  58.         frequency = 700;
  59.         duration  = 165;
  60.         tone( frequency, duration );
  61.  
  62.         frequency = 450;
  63.         duration = 110;
  64.         tone( frequency, duration );
  65.  
  66. }
  67.  
  68.  
  69.  
  70. /**************************************************************************/
  71. /*                                   BELL                                 */
  72. /*                   Produces a succession of 'beep' tones                */
  73. /*               Takes 'times' as argument [# of times to beep]           */
  74. /**************************************************************************/
  75.  
  76. void bell( int times )
  77.  
  78. {
  79.         while( times-- )
  80.             {
  81.             tone(380,165);
  82.             delay (20 );
  83.             }
  84.         return;
  85. }
  86.  
  87. /**************************************************************************/
  88. /*                                   BLATT                                */
  89. /*                         Produces a "Bronx Cheer"                       */
  90. /*                         [use with error routine]                       */
  91. /**************************************************************************/
  92.  
  93. void blatt()
  94.  
  95. {
  96.         tone( 42,330 ); 
  97.         tone(34,220);
  98.         return;  
  99. }
  100.  
  101.